<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>

<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	
	<title>后台首页 - 欢迎使用商城系统</title>
	<link rel="stylesheet" href="http://localhost/meilishuo/Static/bootstrap/css/bootstrap.min.css" />
	<link type="text/css" rel="stylesheet" href="http://localhost/meilishuo/Application/Admin/View/Public/css/style.css" />
	<script type="text/javascript" src="http://localhost/meilishuo/Static/jquery/jquery-1.7.2.min.js"></script>
</head>
<div class="bgimg"></div>
<div class="pagetop">
	<div class="head">
		<div class="logo fl"></div>

		<div class="admin_t fr">
			<ul>
				<li><a href=""><img border=0 src="http://localhost/meilishuo/Application/Admin/View/Public/images/exit4.gif"></a></li>
				<li><a href="<?php echo U('Login/out');?>" onclick="return confirm('你确定要退出系统吗？')" ><img border=0 src="http://localhost/meilishuo/Application/Admin/View/Public/images/exit3.gif"></a></li>
			</ul>
		</div>

		<div class="admin_u fr">
				<b>欢迎您-</b><a title="" target="_top" href="">admin</a>&nbsp;【超级管理员】 &nbsp;&nbsp;
		</div>
		<div class="clear"></div>
	</div>
</div>
<div class="content">
	<div class="main">
		<div class="left">
			<div class="fenlei">
				<h3>商品管理</h3>
				<ul>
					<li ><a href="<?php echo U('Good/index');?>">商品列表</a></li>
					<li ><a href="<?php echo U('Good/add');?>">添加商品</a></li>
					
				</ul>
			</div>
			<div class="fenlei">
				<h3>轮播图管理</h3>
				<ul>
					<li ><a href="<?php echo U('Slide/index');?>">轮播图列表</a></li>
					<li ><a href="<?php echo U('Slide/add');?>">增加轮播图</a></li>
					
				</ul>
			</div>
			<div class="fenlei">
				<h3>类型管理</h3>
				<ul>
					<li ><a href="<?php echo U('Type/index');?>">类型列表</a></li>
					<li ><a href="<?php echo U('Type/add');?>">添加类型</a></li>
				</ul>
			</div>
			<div class="fenlei">
				<h3>分类管理</h3>
				<ul>
					<li ><a href="<?php echo U('Category/index');?>">分类列表</a></li>
					<li ><a href="<?php echo U('Category/add');?>">添加分类</a></li>
				</ul>
			</div>
			<div class="fenlei">
				<h3>品牌管理</h3>
				<ul>
					<li ><a href="<?php echo U('Brand/index');?>">品牌列表</a></li>
					<li ><a href="<?php echo U('Brand/add');?>">添加品牌</a></li>
				</ul>
			</div>
			<div class="fenlei">
				<h3>用户管理</h3>
				<ul>
					<li ><a href="http://localhost/meilishuo/Application/Admin/View/Public/user/list.html">会员列表</a></li>
					<li ><a href="http://localhost/meilishuo/Application/Admin/View/Public/user/admin.html">管理列表</a></li>
				</ul>
			</div>
			<div class="fenlei">
				<h3>控制面板</h3>
				<ul>
					<li ><a href="http://localhost/meilishuo/Application/Admin/View/Public/set/base.html">基本信息</a></li>
					<li ><a href="http://localhost/meilishuo/Application/Admin/View/Public/set/cache.html">缓存管理</a></li>
					<li ><a href="http://localhost/meilishuo/Application/Admin/View/Public/set/link.html">友情链接</a></li>
					<li ><a href="http://localhost/meilishuo/Application/Admin/View/Public/set/ad.html">广告列表</a></li>
				</ul>
			</div>

		</div>
<script type="text/javascript" src="http://localhost/meilishuo/Static/uploadify/jquery-1.8.2.min.js"></script>

<script type="text/javascript" src="http://localhost/meilishuo/Static/uploadify/jquery.uploadify.min.js"></script>

<link href="http://localhost/meilishuo/Static/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
<script type="text/javascript" charset="utf-8" src="http://localhost/meilishuo/Static/ueditor1_4_3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="http://localhost/meilishuo/Static/ueditor1_4_3/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="http://localhost/meilishuo/Static/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>

 <script>
 var ue = UE.getEditor('editor');
 </script>
 <script type="text/javascript">
 	$(function(){
 		
 		
 		
 		
 		$(".inputcate ").change(function(){
 			var cid=$(this).val();
 			
 			$.ajax({
 				type:"post",
 				url:"http://localhost/meilishuo/Admin/Good" + "&a=ajax_get_cate",
 				data:{cid:cid},
 				dataType:'json',
 				success:function(data){
 					
 					msg='';
 					gspec='';
 					$.each(data, function(k,v) {
 					if(v.tptype == '属性'){
 						
	 					msg+='<ul style="float:left; overflow: hidden; height: 50px; width: 950px; border: 1px solid #DDDDDD;"><li style="margin-top:10px; width:150px;float: left;"><input type="hidden" name="tpid[]" value="'+v.tpid+'" />'+v.tpname+'</li><li style="float: left;margin-top:10px;width: 600px;"><select style="width: 100px; border: 1px solid #DDDDDD;" name="gpvalue[]"><option value="">请选择</option>'
	 					
	 					$.each(v.tpvalue,function(key,value){
	 						
	 					msg+='<option value="'+value+'">'+value+'</option>'
	 					});
	 					
						msg+='</select><input type="hidden" name="aprice[]" /></li>\
						</ul>'
 					}else{
 						gspec+='<ul style="float:left; overflow: hidden; height: 50px; width: 950px; border: 1px solid #DDDDDD;"><li style="margin-top:10px; width:150px;float: left;"><input type="hidden"  name="tpid[]" value="'+v.tpid+'" />'+v.tpname+'</li><li style="float: left;margin-top:10px;width: 600px;"><select style="margin-right:50px; width: 100px; border: 1px solid #DDDDDD;" name="gpvalue[]"><option value="">请选择</option>'
 					
	 					$.each(v.tpvalue,function(key,value){
	 						
	 					gspec+='<option value="'+value+'">'+value+'</option>'
	 					});
	 					
						gspec+='</select>附加价格<input type="text" name="aprice[]" /><a class="btn btn-info" style="margin-left:50px" href="javascript:;">添加规格</a></li></ul>'
 					}
 					});
	 					$("#gproperty").html(msg);
	 					$("#gspec").html(gspec);
 				}
 			});
 		})
 		$(".btn-info").live('click',function(){
 			$add = $(this).parent().parent().eq(0).clone();
// 			$add.siblings('li').eq(0).html('删除规格');
 			$("#gspec").append($add);
 			
 		})
 		
 	})
 </script>
 
 <style type="text/css">
 	#uploadList2 ul li img{
 		float: right;
 		width: 50px;
 		height: 50px;
 	}
 	#uploadList2 ul li{
 		float: left;
 	}
 </style>

<div class="right">
	<div class="now">
		<div class="now_l"></div>
		<div class="now_m">
			<span class="fl">发布商品</span>
			<span class="fr fabu"><a href="">发布商品</a></span>
		</div>
		<div class="now_r"></div>
		<div class="clear"></div>
	</div>
	<form method="post" enctype="multipart/form-data">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="wenzhang">
	<tr>
		<td width="100" class="bg_f8" align="right">商品名称：</td>
		<td colspan="3"><input type="text" name="gname" value="<?php echo $data['gname'];?>" class="inputall input500" maxlength="36" /></td>
		<td rowspan="7" valign="top" width="80">
			<div   style="float: ; width:168px;height: 168px; border:1px solid #ddd; display:block;" />
				<div id="uploadList">
					<ul></ul>
				</div>
			</div>
			<p class="mat5">
			
			<div lab="uploadFile">

            <input id="file" type="file" multiple="true">

            <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>

            <script type="text/javascript">

                $(function() {

                    $('#file').uploadify({

                       'formData'     : {//POST数据

                            '<?php echo session_name();?>' : '<?php echo session_id();?>',

                        },

                        'fileTypeDesc' : '上传文件',//上传描述

                        'fileTypeExts' : '<?php echo $set['filetype'];?>',

                        'swf'      : 'http://localhost/meilishuo/Static/uploadify/uploadify.swf',

                        'uploader' : '<?php echo U("upload");?>',

                        'buttonText':'选择文件',

                        'fileSizeLimit' : '2000KB',

                        'uploadLimit' : 1000,//上传文件数

                        'width':65,

                        'height':25,

                        'successTimeout':10,//等待服务器响应时间

                        'removeTimeout' : 0.2,//成功显示时间

                        'onUploadSuccess' : function(file, data, response) {

                            data=$.parseJSON(data);

                            var imageUrl = data.image?data.url:'http://localhost/meilishuo/Static/image/default.png';
							
							$('#lthumb').val(data.path);
                            var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' class='hd-w80 hd-h70'/></li>";

                            $("#uploadList ul").prepend(li);

                        }

                    });

                });

            </script>

            

        </div>

			
			</p>
		</td>
	</tr>
	<tr>
		<td class="bg_f8" align="right">商品分类：</td>
		<td colspan="3">
			<select name="cid" class="inputcate">
						<option value="" >请选择分类</option>
				<?php foreach ($cate as $k=>$v){?>
						<option value="<?php echo $v['cid'];?>"     <?php if($data['cid']==$v['cid']){ ?>selected="selected"<?php } ?>><?php echo $v['_name'];?></option>
				<?php }?>
			</select> 
			
		</td>
	</tr>
	<tr>
		<td class="bg_f8" align="right">所属品牌：</td>
		<td colspan="3">
			<select name="bid" class="inputselect">
						<option value="" >请选择品牌</option>
				<?php foreach ($brand as $k=>$v){?>
						<option     <?php if($data['bid']==$v['bid']){ ?>selected<?php } ?>  value="<?php echo $v['bid'];?>" ><?php echo $v['brand'];?></option>
				<?php }?>
			</select>
		</td>
	</tr>
	<tr>
		<td class="bg_f8" align="right">市价场：</td>
		<td width="250"><input type="text" name="mprice" value="<?php echo $data['mprice'];?>" class="inputall input100" /> <span class="c888">元</span></td>
		<td width="100" class="bg_f8" align="right">单　　位：</td>
		<td><input type="text" name="unit" value="" class="inputall input100" /></td>
	</tr>
	<tr>
		<td class="bg_f8" align="right">商城价：</td>
		<td colspan="3"><input type="text" name="price" value="<?php echo $data['price'];?>" class="inputall input100" /> <span class="c888">元</span></td>
	</tr>
	<tr>
		<td class="bg_f8" align="right">点击次数：</td>
		<td colspan="3"><input type="text" name="click" value="<?php echo $data['price'];?>" class="inputall input100" /></td>
	</tr>
	<tr>
		<td class="bg_f8" align="right">商品图册：</td>
		<td colspan="3">
			<div style="float: left;" lab="uploadFile">

            <input id="file2" type="file" name="" multiple="true">

            <span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>

            <script type="text/javascript">

                $(function() {

                    $('#file2').uploadify({

                       'formData'     : {//POST数据

                            '<?php echo session_name();?>' : '<?php echo session_id();?>',

                        },

                        'fileTypeDesc' : '上传文件',//上传描述

                        'fileTypeExts' : '<?php echo $set['filetype'];?>',

                        'swf'      : 'http://localhost/meilishuo/Static/uploadify/uploadify.swf',

                        'uploader' : '<?php echo U("upload");?>',

                        'buttonText':'选择文件',

                        'fileSizeLimit' : '2000KB',

                        'uploadLimit' : 1000,//上传文件数

                        'width':65,

                        'height':25,

                        'successTimeout':10,//等待服务器响应时间

                        'removeTimeout' : 0.2,//成功显示时间

                        'onUploadSuccess' : function(file, data, response) {

                            data=$.parseJSON(data);

                            var imageUrl = data.image?data.url:'http://localhost/meilishuo/Static/image/default.png';
							
                            var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' class='hd-w80 hd-h70'/><input type='hidden' value='"+data[0]+"' name='sthumb[]' /><input type='hidden' value='"+data[1]+"' name='mthumb[]' /></li>";
							
                            $("#uploadList2 ul").prepend(li);

                        }

                    });

                });

            </script>

            

        </div>
			<div style="float: left;" id="uploadList2">
					<ul></ul>
			</div></td>
	</tr>
	</table>
	<br />
		<h3 style="font-weight: 700;">商品属性</h3>
	<div id="gproperty" style="font-size: 15px;">
		<?php foreach ($gproperty as $k=>$v){?>
		<ul style="float:left; overflow: hidden; height: 50px; width: 950px; border: 1px solid #DDDDDD;">
			<li style="margin-top:10px; width:150px;float: left;">
				<?php echo $v['gpvalue'];?>
				<input type="hidden" name="tpid[]" value="" />
			</li>
			<li style="float: left;margin-top:10px;width: 600px;">
				<select style="width: 100px; border: 1px solid #DDDDDD;" name="gpvalue[]">
					<option value="">请选择</option>
		 			<option value="value"><?php echo $v['gpvalue'];?></option>
				</select>
				<input type="hidden" name="aprice[]" />
			</li>
		</ul>
		<?php }?>
	</div>
	<br />
		<h3 style="font-weight: 700;">商品规格</h3>
	<div id="gspec" style="overflow: hidden; font-size: 15px;">
		
	</div>
	
	<br />
	<h3 style="font-weight: 700;">商品详情</h3>
	<br />
	
	
	
	<div class="mat5"><script id="editor" type="text/plain" style="width:100%;height:500px;"><?php echo $gdata['gdetails'];?></script>  </div>
	<div class="mat10 center">
		<input type="hidden" id="lthumb" value="" name="lthumb" />
		<input type="submit" value="修 改" class="tjbtn" />
	</div>
	</form>
</div>
<style type="text/css"> 
a.js_add{display:block; float:left; width:120px; height:30px; line-height:30px; text-align:center;background:#76A500; color:#f5f5f5; border-radius:2px; font-family:'宋体'; font-size:14px; font-weight:bold}
a:hover.js_add,a:hover.js_del{background-color:#cccc00;}
a.js_del{width:42px; padding:5px 10px; text-align:center;background:#FF9900; color:#f5f5f5; border-radius:2px; font-family:'宋体'; font-size:12px;}
</style>

		<div class="clear"></div>
	</div>
	<div class="foot">Copyright <span class="num">&copy;</span> 2014-2017 <a target="_blank" href="#"></a> 版权所有</div>

</div>



</body>
</html>	
